rem 0step 删除已有mykeystore.cert，policy和store
del mykeystore.policy
del mykeystore.store
del mykeystore.cert
rem	
rem 1step 切换到java bin目录
rem 配置Java的环境变量即可
rem cd "C:/Program Files/Java/jdk1.8.0_281/bin"
rem
rem 2step 使用keytool工具生成密匙库
rem 请改成你的相关信息-dname 后的引号中内容
 keytool -genkey -alias mykey -keystore mykeystore.store -keypass mykeypass -storepass mystorepass  -validity 365  -dname "CN=liudongliang, OU=chzu, L=xxxy, S=chuzhou, O=anhui, C=CH" 
rem
rem
rem 3step 使用keytool工具导出签名时用到的证书
rem 输入密钥库口令:mystorepass
 keytool -export -keystore mykeystore.store -alias mykey -validity 365 -file mykeystore.cert
rem
rem
rem 4step 压缩class类文件为jar包
javac *.java -d .
jar cvfe GuiCalculator.jar gitops.idegitplugin.GuiCalculator gitops/idegitplugin/*.class
rem
rem
rem 5step 使用jarsigner工具签名jar压缩文档
rem 输入密钥库的密码短语:mystorepass
rem
rem 输入mykey的密钥口令:mykeypass
 jarsigner -keystore myKeystore.store GuiCalculator.jar mykey
rem
rem
rem 6step 创建myKeystore.policy文件
 echo keystore "file:myKeystore.store","JKS"; grant signedBy "mykey" { permission java.io.FilePermission"<<ALL FILES>>","read";};>myKeystore.policy
rem
rem 7step 打包、部署
mkdir vscodegitplugin
copy mykeystore.policy vscodegitplugin
copy mykeystore.store vscodegitplugin
copy mykeystore.cert vscodegitplugin
copy index.html vscodegitplugin
copy GuiCalculator.jar vscodegitplugin
copy GuiCalculator.jnlp vscodegitplugin
cd vscodegitplugin
jar cvf vscodegitplugin.war *
copy vscodegitplugin.war "C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps"
rem
rem 8step 测试
javaws GuiCalculator.jnlp
rem
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" http://www.czldl.net/vscodegitplugin/index.html
rem

echo OK!
